The module is now only used inside the gnome-shell process, so
we don't have to handle the case where it is used from prefs,
and we can use regular imports for shell modules.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2837>
pgettext
} from './sharedInternals.js';
+const {extensionManager} = imports.ui.main;
+
/**
* Open the preference dialog of the current extension
*/
if (!extension)
throw new Error('openPrefs() can only be called from extensions');
- try {
- const extensionManager = imports.ui.main.extensionManager;
- extensionManager.openExtensionPrefs(extension.uuid, '', {});
- } catch (e) {
- if (e.name === 'ImportError')
- throw new Error('openPrefs() cannot be called from preferences');
- logError(e, 'Failed to open extension preferences');
- }
+ extensionManager.openExtensionPrefs(extension.uuid, '', {});
}